package svc

import (
	"api/internal/config"
	"api/internal/middleware"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"goods_srv/goodsclient"
)

type ServiceContext struct {
	Config     config.Config
	AuthThoken rest.Middleware
	GoodSrv    goodsclient.Goods
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:     c,
		AuthThoken: middleware.NewAuthThokenMiddleware().Handle,
		GoodSrv:    goodsclient.NewGoods(zrpc.MustNewClient(c.GoodSrv)),
	}
}
